<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>事件基本使用</title>
        <script type="text/javascript" src="./vue.js"></script>
	</head>
	<body>
        <div id="root">
            <h2>欢迎来到{{name}}上班</h2>            
            <!--v-on:click可用@click  -->
            <button @click="showInfo1">点击提示信息1</button>
            <button @click="showInfo2(123,$event)">点击提示信息2(传参)</button>
            
        </div>
    </body>
    <script type="text/javascript">
        Vue.config.productionTip = false //防止VUe启动生成生产提示。
        new Vue({
            el:'#root',
            data:{
                name:'罗德岛'
            },
            methods:{
                
                showInfo1(event){
                    //console.log(event.target.innerText)
                    //console.log(this)     //这里的this是vm
                    alert('博士你好')
                },
                showInfo2(number,event){
                    //console.log(event.target.innerText)
                    console.log(number,event)     //这里的this是vm
                    alert('博士你好!!!')
            }
        }
        })
    </script>
</html>